﻿CREATE PROCEDURE [dbo].[yaf_accessmask_list](
                @BoardID      INT,
                @AccessMaskID INT  = NULL)
AS
    BEGIN
        IF @AccessMaskID IS NULL
        SELECT   a.*
        FROM     yaf_AccessMask a
        WHERE    a.BoardID = @BoardID
        ORDER BY a.Name
        ELSE
        SELECT   a.*
        FROM     yaf_AccessMask a
        WHERE    a.BoardID = @BoardID
        AND a.AccessMaskID = @AccessMaskID
        ORDER BY a.Name
    END


